package gui.menubar;

import gui.MainWindow;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JSeparator;

import model.MetroModel;

/**
 * 
 * @author Ilya Shurigyn
 *
 */
public class EditMenu extends JMenu {
	public EditMenu(MainWindow parent) {
		super("Edit");
		//add(new RedoMenuItem());
		add(new RedoMenuItem());
		add(new UndoMenuItem());		
		//---
		add(new JSeparator());
		add(new ScaleMenuItem(parent));
		add(new AddDrawerMenuItem());
	
		
	}
}

/**
 * Undo item for editor menu
 * @author Ilya Shurigyn
 *
 */
class UndoMenuItem extends JMenuItem {
	public UndoMenuItem(){
		super("Undo");
		addActionListener(new ActionListener(){
			@Override
			public void actionPerformed(ActionEvent e) {
				MetroModel.getInstance().undo();
			}
			
		});
	}
}

/**
 * Redo item for editor menu
 * @author Ilya Shurigyn
 *
 */
 class RedoMenuItem extends JMenuItem {
	public RedoMenuItem(){
		super("Redo");
		addActionListener(new ActionListener(){
			@Override
			public void actionPerformed(ActionEvent e) {
				MetroModel.getInstance().redo();
			}
			
		});
	}
}
 

